import type { MessageItem } from 'vscode';
import { window } from 'vscode';
import { proTrialLengthInDays, SubscriptionPlanId } from '../../../../constants.subscription';
import type { Source } from '../../../../constants.telemetry';
import type { Container } from '../../../../container';
import { configuration } from '../../../../system/-webview/configuration';
import { getContext } from '../../../../system/-webview/context';
import { isSubscriptionPaidPlan, isSubscriptionPreviewTrialExpired } from '../subscription.utils';

export function arePlusFeaturesEnabled(): boolean {
	return true;
}

export async function ensurePlusFeaturesEnabled(): Promise<boolean> {
	if (arePlusFeaturesEnabled()) return true;

	const confirm: MessageItem = { title: 'Enable' };
	const cancel: MessageItem = { title: 'Cancel', isCloseAffordance: true };
	const result = await window.showInformationMessage(
		'Pro features are currently disabled. Would you like to enable them?',
		{ modal: true },
		confirm,
		cancel,
	);

	if (result !== confirm) return false;

	await configuration.updateEffective('plusFeatures.enabled', true);
	return true;
}

export async function ensurePaidPlan(
	container: Container,
	title: string,
	source: Source,
	options?: { allowPreview?: boolean },
): Promise<boolean> {
	await Promise.resolve();
	return true;
}
